<?php
	require_once($_SERVER['DOCUMENT_ROOT']."/classes/Mood.class.php");
	require_once($_SERVER['DOCUMENT_ROOT']."/includes/sugar.php");
	session_start();
	$mood = new Mood($_POST['id']);
	$mood->toggleActivation();
	if($mood->save()){
		$array['errMess'] = ($mood->isActivated == 1)? getErrMess(29):getErrMess(28);
		$array['status'] = 1;
	}
	else
	{
		$array['errMess'] = getErrMess(30);
		$array['status'] = 0;
	}
	$array['id'] = $_POST['id'];
	$array['content'] = $mood->summary();
	echo json_encode($array);
?>